import { createStore } from 'vuex'
import category from './modules/category'
import user from './modules/user'
// 数据持久化
import persistedState from 'vuex-persistedstate'

export default createStore({
  strict: process.env.NODE_ENV === 'development',
  state: {
  },
  getters: {
  },
  mutations: {
  },
  actions: {
  },
  modules: {
    category,
    user
  },
  // plugins: [persistedState()], 会将全部vuex数据都保存
  plugins: [
    // 默认存储在localstorage中
    persistedState({
      key: 'sjj',
      paths: ['user']
      // storage: localStorage // 默认存到localStorage中，也可以换成sessionStorage
    })
  ]
})
